﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/AdminMaster.master" AutoEventWireup="true" CodeFile="BriefMaster.aspx.cs" Inherits="Admin_BriefMaster" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
    .auto-style1 {
        width: 164px;
    }
    .auto-style2 {
        width: 88px;
    }
    .auto-style3 {
        width: 141px;
    }
</style>
    <script type="text/javascript">
        function onClickLinkDocumentDownload(strPathProDoc) {
            WindowObjectReference = window.open(strPathProDoc, "DescriptiveWindowName", "resizable=yes,scrollbars=yes,status=yes");

        }
        function CallCodeBehindMethod() {
            pageName.CallClose(OnSuccess, OnFailed);
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <table style="width: 100%" id="TABLE1" cellspacing="1" cellpadding="1" border="0">
        <tbody>
            <tr>
                <td style="height: 30px; text-align: center" colspan="3">
                    <table id="TABLE3">
                        <tbody>
                            <tr>
                                <td colspan="7" style="text-align: left;">
                                    <h2>Brief Master</h2>
                                </td>
                            </tr>
                            <tr>
                                <td style="vertical-align: middle;" align="right" class="auto-style1">
                                           Country Name&nbsp;&nbsp;:&nbsp;&nbsp;
                                        </td>
                                        <td style="width: 100px;vertical-align: middle;">
                                             <asp:DropDownList ID="ddlCountryName" runat="server"  Width="181px" MaxLength="50" OnSelectedIndexChanged="ddlCountryName_SelectedIndexChanged">                               
                                                           
                            </asp:DropDownList>
                                          </td> 
                                        <td style="vertical-align: middle;" align="right" class="auto-style3">
                                            &nbsp;Brief Title&nbsp;&nbsp;:&nbsp;&nbsp;
                                        </td>
                                        <td style="width: 100px;vertical-align: middle;">
                                            <asp:TextBox ID="txtBriefTitle" runat="server" Width="139px" MaxLength="50">
                                            </asp:TextBox></td>
                                <td align="left" class="auto-style2" style="width: 92px;">
                                            <asp:Button ID="btnSearch" runat="server"
                                                Text="Search" CausesValidation="false" OnClick="btnSearch_Click" ></asp:Button></td>
                                <td style="width: 142px" align="left">&nbsp;
                                            <asp:Button ID="btnClear"  runat="server"
                                                Text="Clear" CausesValidation="false" OnClick="btnClear_Click"></asp:Button></td>
                                <td style="width: 18%; text-align: right" align="right">
                                    <asp:Button ID="btnAddNew"  runat="server" 
                                        Text="Add New Brief" CausesValidation="false" OnClick="btnAddNew_Click"></asp:Button></td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
             <tr>
                <td colspan="3"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Label runat="server" ID="lblErrorMessage"  ></asp:Label>
                    </td>
                 </tr>
            <tr>
                <td align="center" colspan="3">
                    <div class="grd_table" style="overflow-x: auto; width: 900pt">

                      <%--  <asp:GridView ID="gvSearchResult" runat="server" OnRowEditing="gvSearchResult_RowEditing" OnRowDeleting="gvSearchResult_RowDeleting"
                            OnPageIndexChanging="gvSearchResult_PageIndexChanging" OnRowCommand="gvSearchResult_RowCommand"                           
                           PageSize="10" AllowPaging="true" Width="95%"
                            AutoGenerateColumns="false" OnSelectedIndexChanged="gvSearchResult_SelectedIndexChanged">
                            <Columns>
                                 
                                <asp:BoundField DataField="CountryId" HeaderText="Country">
                                    <ItemStyle Width="5%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>  
                                <asp:BoundField DataField="BriefTitle" HeaderText="Brief Title ">
                                    <ItemStyle Width="5%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>  
                                <asp:BoundField DataField="BriefDesc" HeaderText="Brief Description">
                                    <ItemStyle Width="5%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>
                                <asp:BoundField DataField="BriefStatus" HeaderText="Brief Status">
                                    <ItemStyle Width="5%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>   
                                <asp:BoundField DataField="BriefStartDate" HeaderText="Brief Start Date">
                                    <ItemStyle Width="5%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>                               
                                <asp:BoundField DataField="BriefEndDate" HeaderText="Brief End Date">
                                    <ItemStyle Width="5%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>                                         
                                           
                                 <asp:BoundField DataField="CreatedBy" Visible="false" HeaderText="Created By">
                                    <ItemStyle Width="5%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>
                                <asp:BoundField DataField="CreatedDate" Visible="false" HeaderText="Created Date">
                                    <ItemStyle Width="5%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>
                                <asp:BoundField DataField="ModifyBy" Visible="false" HeaderText="Modify By">
                                    <ItemStyle Width="5%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>
                                <asp:BoundField DataField="ModifyDate" Visible="false" HeaderText="Modify Date">
                                    <ItemStyle Width="5%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>                                          
                                <asp:TemplateField HeaderText="Active" ItemStyle-HorizontalAlign="center">
                                    <ItemTemplate>
                                      <input type="checkbox" runat="server" readonly="readonly" id="chkIsActive" checked='<%# Eval("IsActive") %>' onclick="return false" enableviewstate="true" />
                                    </ItemTemplate>
                                    <ItemStyle Width="5%" />
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="false" CommandName="Edit"
                                            CommandArgument='<%# Eval("BriefID") %>'>Edit</asp:LinkButton>
                                    </ItemTemplate>
                                    <ItemStyle Width="5%" />
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>--%>




                        <asp:GridView ID="gvBrief" runat="server" DataKeyNames="BriefID" AllowPaging="True" Width="100%"
                            AutoGenerateColumns="False" OnPageIndexChanging="gvBrief_PageIndexChanging" OnRowDataBound="gvBrief_RowDataBound" OnRowDeleting="gvBrief_RowDeleting" OnSelectedIndexChanged="gvBrief_SelectedIndexChanged" OnRowCommand="gvBrief_RowCommand" PageSize="5">
                            
                            <Columns >
                               <asp:BoundField DataField="BriefID" HeaderText="Brief ID"  Visible="false">
                                    <ItemStyle   HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>
                                <asp:BoundField DataField="CountryName" HeaderText="Country Name">
                                    <ItemStyle Width="10%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" Width="10%" />
                                </asp:BoundField>  
                                <asp:BoundField DataField="BriefTitle" HeaderText="Brief Title">
                                    <ItemStyle Width="20%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" Width="20%" />
                                </asp:BoundField>  
                                 <asp:BoundField DataField="BriefDesc" HeaderText="Brief Description" >
                                    <ItemStyle Width="20%" HorizontalAlign="Left" Wrap="true"  />
                                    <HeaderStyle HorizontalAlign="Left" Wrap="true" />
                                </asp:BoundField>  
                                
                                  <asp:BoundField DataField="BriefStatus" HeaderText="Brief Status">
                                    <ItemStyle Width="5%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>  

                                  <asp:BoundField DataField="BriefStartDate" HeaderText="Brief Start Date">
                                    <ItemStyle Width="10%" HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>  
                                 <asp:BoundField DataField="BriefEndDate" HeaderText="Brief End Date" InsertVisible="true" Visible="false" >
                                    <ItemStyle HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField> 
                                <asp:BoundField DataField="Status" HeaderText="Status">
                                    <ItemStyle Width="5%" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField> 
                              <%--  <asp:HyperLinkField DataNavigateUrlFields="BriefID" DataNavigateUrlFormatString="~/Admin/BriefMasterModify.aspx?bgid={0}&mod=up"
                            HeaderText="Edit" Text="Edit" ItemStyle-Width="6%" ItemStyle-HorizontalAlign="left"/>--%>

                                <asp:TemplateField HeaderText="Edit" Visible="false">
                                    <ItemStyle Width="6%" HorizontalAlign="Left" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkEdit"  PostBackUrl='<%# Eval("BriefID", "~/Admin/BriefMasterModify.aspx?bgid={0}&mod=up") %>'  CommandArgument='<% Eval("BriefID") %>' CommandName="Edit" runat="server"><%# Convert.ToBoolean(Eval("IsAllDeleted")) == false ? "Edit" : ""%></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                 <asp:TemplateField HeaderText="Delete">

                                      <ItemStyle Width="5%" HorizontalAlign="left" />
                                 <ItemTemplate>
                                   <asp:LinkButton ID="lnkDelete" CommandArgument='<%# Eval("BriefID") %>' CommandName="Delete" runat="server"><%# Eval("ActiveStatus") %></asp:LinkButton>
                                 </ItemTemplate>
                               </asp:TemplateField>
                                <asp:TemplateField HeaderText="Delete Brief Candidate">                                 
                                 <ItemTemplate>
                                   <asp:LinkButton ID="lnkDeleteBriefAll" CommandArgument='<%# Eval("BriefID") %>' CommandName="DeleteAll" runat="server"><%# Convert.ToBoolean(Eval("IsAllDeleted")) == false ? "DeleteAll" : ""%></asp:LinkButton>
                                 </ItemTemplate>
                               </asp:TemplateField>

                                <asp:BoundField  DataField="BriefDocument" HeaderText="Brief Document" >
                                    <ItemStyle Width="3%" HorizontalAlign="Left" />
                                    </asp:BoundField>
                                <asp:TemplateField ItemStyle-Width="10%" HeaderText="Brief File">
                                    <ItemTemplate>
                                        <asp:HyperLink runat="server" NavigateUrl='<%# GetBriefDownload(Eval("BriefDocument"))%>' Text="Download" HorizontalAlign="Left"></asp:HyperLink>
                                    </ItemTemplate>
                                    <ItemStyle Width="10%"></ItemStyle>
                                </asp:TemplateField>
                                <asp:BoundField DataField="GDDocument" HeaderText="Guide Discussion Document" >
                                    <ItemStyle Width="3%" HorizontalAlign="Left" />
                                    </asp:BoundField>
                                 <asp:TemplateField ItemStyle-Width="10%" HeaderText="Guide Discussion File">
                                    <ItemTemplate>
                                        <asp:HyperLink runat="server" NavigateUrl='<%# GetGDDownload(Eval("GDDocument"))%>' Text="Download" HorizontalAlign="Left"></asp:HyperLink>
                                    </ItemTemplate>
                                    <ItemStyle Width="10%"></ItemStyle>
                                </asp:TemplateField>

                                <asp:BoundField DataField="CountryID" HeaderText="CountryID" Visible="False" />

                                <asp:BoundField DataField="BriefInOtherCountries" HeaderText="Brief In Other Countrys" />
                                <asp:TemplateField HeaderText="&nbsp;Brief Assign to Other Country" ShowHeader="false">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="btnPopUp" runat="server" CommandName="POPUP" Text="Assign to Other Country"
                                            CommandArgument='<%# Eval("BriefID")+"="+Eval("BriefTitle")+"="+Eval("BriefDesc") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>

                            </Columns>
                             <FooterStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#E2DED6" ForeColor="blue" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#CCCCCC" />
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        </asp:GridView>
                    </div>
                </td>
            </tr>
            <tr>
                <td align="right" colspan="3">
                     <input id="hdnInput" runat="server" type="hidden" />
                </td>

            </tr>
            <tr>
                <td colspan="3">
                    <asp:Button runat="server" ID="btnNoUse" Text="" Style="display: none;" />
                    <cc1:ModalPopupExtender ID="mp1" runat="server" PopupControlID="Panl1" TargetControlID="btnNoUse"
                        BackgroundCssClass="icon-white" OnCancelScript="return CallCodeBehindMethod();">
                    </cc1:ModalPopupExtender>
                    <asp:Panel ID="Panl1" runat="server" CssClass="Popup" align="center" BorderWidth="5px" Style="display: none" BackgroundCssClass="icon-white" BackColor="white">
                        <%--<iframe style="background-color: white; width: 1200px; height: 560px;margin-right:-3px" id="irm1" runat="server">--%>
                            <table>
                                <tr>
                                    <td colspan="3"> <h3>Brief assign to other Country</h3></td>
                                    <asp:HiddenField ID="hfCntryBriefId" runat="server" />
                                </tr>
                                <tr>
                                    <td align="right">Brief Name</td>
                                    <td>&nbsp;&nbsp;:&nbsp;&nbsp;</td>
                                    <td  align="left"><asp:Label ID="lblCntryBriefName" runat="server" Text=""></asp:Label></td>
                                </tr>
                                <tr>
                                    <td align="right">Brief Description</td>
                                    <td>&nbsp;&nbsp;:&nbsp;&nbsp;</td>
                                    <td align="left"><asp:Label ID="lblCntryBriefDesc" runat="server" Text=""></asp:Label></td>
                                </tr>
                                <tr>
                                    <td align="right">Country List &nbsp;<font color="red">*</font></td>
                                    <td>&nbsp;&nbsp;:&nbsp;&nbsp;</td>
                                    <td align="left">
                                        <asp:Panel Style="width: 250px; height: 150px; borderwidth=1px" ID="pnlCountry" ScrollBars="Vertical" runat="server" BorderColor="#DEDCDC" BorderWidth="2px" CssClass="extraBottomRemove">
                                            <asp:CheckBoxList ID="chkCountry" runat="server" CellPadding="6" CellSpacing="6"></asp:CheckBoxList>&nbsp;
                                        </asp:Panel>
                                        <asp:CustomValidator ID="cstCountry" Display="Dynamic" runat="server" ForeColor="red" ValidationGroup="CountryValidation" ErrorMessage="Select Country" OnServerValidate="cstCountry_ServerValidate"></asp:CustomValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right"></td>
                                    <td colspan="2">
                                        <asp:Button ID="btnSaveToCountry" runat="server" Text="Save"  OnClick="btnSaveToCountry_Click" ValidationGroup="CountryValidation" /></td>
                                </tr>
                                <tr>
                                    <td align="left" colspan="3">
                                        <asp:Label ID="lblCountryErr" runat="server" Text=""></asp:Label></td>
                                </tr>
                            </table>
                        <%--</iframe>--%>
                        <br />
                        <asp:Button ID="PopUpClose" runat="server" Text="Close" OnClick="PopUpClose_Click" />
                    </asp:Panel>
                </td>
        </tr>
            
        </tbody>
    </table>


</asp:Content>

